<!DOCTYPE html><html lang="zh-CN" data-theme="light"><head><meta charset="UTF-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width, initial-scale=1.0,viewport-fit=cover"><title>Linux | C·辰</title><meta name="author" content="辰"><meta name="copyright" content="辰"><meta name="format-detection" content="telephone=no"><meta name="theme-color" content="#ffffff"><meta name="description" content="Linux">
<meta property="og:type" content="article">
<meta property="og:title" content="Linux">
<meta property="og:url" content="http://example.com/2023/05/05/Linux/index.html">
<meta property="og:site_name" content="C·辰">
<meta property="og:description" content="Linux">
<meta property="og:locale" content="zh_CN">
<meta property="og:image" content="https://chen-1317386995.cos.ap-guangzhou.myqcloud.com/Blog/images/Linux.jpg">
<meta property="article:published_time" content="2023-05-05T14:22:22.000Z">
<meta property="article:modified_time" content="2023-09-10T05:57:10.974Z">
<meta property="article:author" content="辰">
<meta property="article:tag" content="Linux">
<meta name="twitter:card" content="summary">
<meta name="twitter:image" content="https://chen-1317386995.cos.ap-guangzhou.myqcloud.com/Blog/images/Linux.jpg"><link rel="shortcut icon" href="https://chen-1317386995.cos.ap-guangzhou.myqcloud.com/Blog/images/Bell.ico"><link rel="canonical" href="http://example.com/2023/05/05/Linux/index.html"><link rel="preconnect" href="//cdn.jsdelivr.net"/><link rel="preconnect" href="//busuanzi.ibruce.info"/><link rel="stylesheet" href="/css/index.css"><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free/css/all.min.css" media="print" onload="this.media='all'"><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fancyapps/ui/dist/fancybox/fancybox.min.css" media="print" onload="this.media='all'"><script>const GLOBAL_CONFIG = { 
  root: '/',
  algolia: undefined,
  localSearch: {"path":"/search.xml","languages":{"hits_empty":"找不到您查询的内容：${query}","hits_stats":"共找到 ${hits} 篇文章"}},
  translate: undefined,
  noticeOutdate: undefined,
  highlight: {"plugin":"highlighjs","highlightCopy":true,"highlightLang":true,"highlightHeightLimit":false},
  copy: {
    success: '复制成功',
    error: '复制错误',
    noSupport: '浏览器不支持'
  },
  relativeDate: {
    homepage: false,
    post: false
  },
  runtime: '',
  dateSuffix: {
    just: '刚刚',
    min: '分钟前',
    hour: '小时前',
    day: '天前',
    month: '个月前'
  },
  copyright: undefined,
  lightbox: 'fancybox',
  Snackbar: undefined,
  source: {
    justifiedGallery: {
      js: 'https://cdn.jsdelivr.net/npm/flickr-justified-gallery/dist/fjGallery.min.js',
      css: 'https://cdn.jsdelivr.net/npm/flickr-justified-gallery/dist/fjGallery.min.css'
    }
  },
  isPhotoFigcaption: false,
  islazyload: true,
  isAnchor: false,
  percent: {
    toc: true,
    rightside: false,
  }
}</script><script id="config-diff">var GLOBAL_CONFIG_SITE = {
  title: 'Linux',
  isPost: true,
  isHome: false,
  isHighlightShrink: false,
  isToc: true,
  postUpdate: '2023-09-10 13:57:10'
}</script><noscript><style type="text/css">
  #nav {
    opacity: 1
  }
  .justified-gallery img {
    opacity: 1
  }

  #recent-posts time,
  #post-meta time {
    display: inline !important
  }
</style></noscript><script>(win=>{
    win.saveToLocal = {
      set: function setWithExpiry(key, value, ttl) {
        if (ttl === 0) return
        const now = new Date()
        const expiryDay = ttl * 86400000
        const item = {
          value: value,
          expiry: now.getTime() + expiryDay,
        }
        localStorage.setItem(key, JSON.stringify(item))
      },

      get: function getWithExpiry(key) {
        const itemStr = localStorage.getItem(key)

        if (!itemStr) {
          return undefined
        }
        const item = JSON.parse(itemStr)
        const now = new Date()

        if (now.getTime() > item.expiry) {
          localStorage.removeItem(key)
          return undefined
        }
        return item.value
      }
    }
  
    win.getScript = url => new Promise((resolve, reject) => {
      const script = document.createElement('script')
      script.src = url
      script.async = true
      script.onerror = reject
      script.onload = script.onreadystatechange = function() {
        const loadState = this.readyState
        if (loadState && loadState !== 'loaded' && loadState !== 'complete') return
        script.onload = script.onreadystatechange = null
        resolve()
      }
      document.head.appendChild(script)
    })
  
    win.getCSS = (url,id = false) => new Promise((resolve, reject) => {
      const link = document.createElement('link')
      link.rel = 'stylesheet'
      link.href = url
      if (id) link.id = id
      link.onerror = reject
      link.onload = link.onreadystatechange = function() {
        const loadState = this.readyState
        if (loadState && loadState !== 'loaded' && loadState !== 'complete') return
        link.onload = link.onreadystatechange = null
        resolve()
      }
      document.head.appendChild(link)
    })
  
      win.activateDarkMode = function () {
        document.documentElement.setAttribute('data-theme', 'dark')
        if (document.querySelector('meta[name="theme-color"]') !== null) {
          document.querySelector('meta[name="theme-color"]').setAttribute('content', '#0d0d0d')
        }
      }
      win.activateLightMode = function () {
        document.documentElement.setAttribute('data-theme', 'light')
        if (document.querySelector('meta[name="theme-color"]') !== null) {
          document.querySelector('meta[name="theme-color"]').setAttribute('content', '#ffffff')
        }
      }
      const t = saveToLocal.get('theme')
    
          if (t === 'dark') activateDarkMode()
          else if (t === 'light') activateLightMode()
        
      const asideStatus = saveToLocal.get('aside-status')
      if (asideStatus !== undefined) {
        if (asideStatus === 'hide') {
          document.documentElement.classList.add('hide-aside')
        } else {
          document.documentElement.classList.remove('hide-aside')
        }
      }
    
    const detectApple = () => {
      if(/iPad|iPhone|iPod|Macintosh/.test(navigator.userAgent)){
        document.documentElement.classList.add('apple')
      }
    }
    detectApple()
    })(window)</script><meta name="generator" content="Hexo 6.3.0"></head><body><div id="sidebar"><div id="menu-mask"></div><div id="sidebar-menus"><div class="avatar-img is-center"><img src= "" data-lazy-src="/img/loading.gif" data-original="https://chen-1317386995.cos.ap-guangzhou.myqcloud.com/Blog%2Fimages%2Favatar.jpg" onerror="onerror=null;src='/img/friend_404.gif'" alt="avatar"/></div><div class="sidebar-site-data site-data is-center"><a href="/archives/"><div class="headline">文章</div><div class="length-num">32</div></a><a href="/tags/"><div class="headline">标签</div><div class="length-num">28</div></a><a href="/categories/"><div class="headline">分类</div><div class="length-num">10</div></a></div><hr/><div class="menus_items"><div class="menus_item"><a class="site-page" href="/"><i class="fa-fw fas fa-home"></i><span> 首页</span></a></div><div class="menus_item"><a class="site-page" href="/archives/"><i class="fa-fw fa fa-archive"></i><span> 时间轴</span></a></div><div class="menus_item"><a class="site-page group" href="javascript:void(0);"><i class="fa-fw fa fa-graduation-cap"></i><span> 博文</span><i class="fas fa-chevron-down"></i></a><ul class="menus_item_child"><li><a class="site-page child" href="/categories/"><i class="fa-fw fa fa-folder-open"></i><span> 分类</span></a></li><li><a class="site-page child" href="/tags/"><i class="fa-fw fa fa-tags"></i><span> 标签</span></a></li><li><a class="site-page child" href="/archives/"><i class="fa-fw fa fa-folder-open"></i><span> 归档</span></a></li></ul></div><div class="menus_item"><a class="site-page group" href="javascript:void(0);"><i class="fa-fw fas fa-list"></i><span> Demo</span><i class="fas fa-chevron-down"></i></a><ul class="menus_item_child"><li><a class="site-page child" href="/c2c_shop/"><i class="fa-fw fa fa-comments-o"></i><span> 商城</span></a></li></ul></div></div></div></div><div class="post" id="body-wrap"><header class="post-bg" id="page-header" style="background-image: url('https://chen-1317386995.cos.ap-guangzhou.myqcloud.com/Blog/images/Linux.jpg')"><nav id="nav"><span id="blog-info"><a href="/" title="C·辰"><span class="site-name">C·辰</span></a></span><div id="menus"><div id="search-button"><a class="site-page social-icon search" href="javascript:void(0);"><i class="fas fa-search fa-fw"></i><span> 搜索</span></a></div><div class="menus_items"><div class="menus_item"><a class="site-page" href="/"><i class="fa-fw fas fa-home"></i><span> 首页</span></a></div><div class="menus_item"><a class="site-page" href="/archives/"><i class="fa-fw fa fa-archive"></i><span> 时间轴</span></a></div><div class="menus_item"><a class="site-page group" href="javascript:void(0);"><i class="fa-fw fa fa-graduation-cap"></i><span> 博文</span><i class="fas fa-chevron-down"></i></a><ul class="menus_item_child"><li><a class="site-page child" href="/categories/"><i class="fa-fw fa fa-folder-open"></i><span> 分类</span></a></li><li><a class="site-page child" href="/tags/"><i class="fa-fw fa fa-tags"></i><span> 标签</span></a></li><li><a class="site-page child" href="/archives/"><i class="fa-fw fa fa-folder-open"></i><span> 归档</span></a></li></ul></div><div class="menus_item"><a class="site-page group" href="javascript:void(0);"><i class="fa-fw fas fa-list"></i><span> Demo</span><i class="fas fa-chevron-down"></i></a><ul class="menus_item_child"><li><a class="site-page child" href="/c2c_shop/"><i class="fa-fw fa fa-comments-o"></i><span> 商城</span></a></li></ul></div></div><div id="toggle-menu"><a class="site-page" href="javascript:void(0);"><i class="fas fa-bars fa-fw"></i></a></div></div></nav><div id="post-info"><h1 class="post-title">Linux</h1><div id="post-meta"><div class="meta-firstline"><span class="post-meta-date"><i class="far fa-calendar-alt fa-fw post-meta-icon"></i><span class="post-meta-label">发表于</span><time class="post-meta-date-created" datetime="2023-05-05T14:22:22.000Z" title="发表于 2023-05-05 22:22:22">2023-05-05</time><span class="post-meta-separator">|</span><i class="fas fa-history fa-fw post-meta-icon"></i><span class="post-meta-label">更新于</span><time class="post-meta-date-updated" datetime="2023-09-10T05:57:10.974Z" title="更新于 2023-09-10 13:57:10">2023-09-10</time></span><span class="post-meta-categories"><span class="post-meta-separator">|</span><i class="fas fa-inbox fa-fw post-meta-icon"></i><a class="post-meta-categories" href="/categories/Cloud/">Cloud</a></span></div><div class="meta-secondline"><span class="post-meta-separator">|</span><span class="post-meta-wordcount"><i class="far fa-file-word fa-fw post-meta-icon"></i><span class="post-meta-label">字数总计:</span><span class="word-count">3.6k</span><span class="post-meta-separator">|</span><i class="far fa-clock fa-fw post-meta-icon"></i><span class="post-meta-label">阅读时长:</span><span>12分钟</span></span><span class="post-meta-separator">|</span><span class="post-meta-pv-cv" id="" data-flag-title="Linux"><i class="far fa-eye fa-fw post-meta-icon"></i><span class="post-meta-label">阅读量:</span><span id="busuanzi_value_page_pv"><i class="fa-solid fa-spinner fa-spin"></i></span></span></div></div></div></header><main class="layout" id="content-inner"><div id="post"><article class="post-content" id="article-container"><h1 id="Linux"><a href="#Linux" class="headerlink" title="Linux"></a>Linux</h1><p><img src= "" data-lazy-src="/img/loading.gif" data-original="https://chen-1317386995.cos.ap-guangzhou.myqcloud.com/Blog/images/Linux.jpg" alt="Linux"></p>
<h1 id="环境搭建"><a href="#环境搭建" class="headerlink" title="环境搭建"></a>环境搭建</h1><blockquote>
<p><strong>Window</strong>：安装CentOS</p>
</blockquote>
<ul>
<li>镜像</li>
</ul>
<p><a target="_blank" rel="noopener" href="http://mirrors.aliyun.com/centos/7/isos/x86_64/">centos-7-isos-x86_64安装包下载_开源镜像站-阿里云 (aliyun.com)</a></p>
<p><a target="_blank" rel="noopener" href="https://blog.csdn.net/weixin_44175418/article/details/123592684?ops_request_misc=%7B%22request_id%22:%22169191963116800185889243%22,%22scm%22:%2220140713.130102334..%22%7D&request_id=169191963116800185889243&biz_id=0&utm_medium=distribute.pc_search_result.none-task-blog-2~all~top_click~default-2-123592684-null-null.142%5Ev92%5EchatgptT0_1&utm_term=Vm%E5%AE%89%E8%A3%85centos&spm=1018.2226.3001.4187">VMware安装CentOs</a></p>
<br/>

<blockquote>
<p>**ECS **： Xshell</p>
</blockquote>
<ul>
<li><p>安装：<a target="_blank" rel="noopener" href="https://blog.csdn.net/weixin_44175418/article/details/123592684?ops_request_misc=%7B%22request_id%22:%22169374596716800222876629%22,%22scm%22:%2220140713.130102334..%22%7D&request_id=169374596716800222876629&biz_id=0&utm_medium=distribute.pc_search_result.none-task-blog-2~all~top_click~default-1-123592684-null-null.142%5Ev93%5EchatgptT3_1&utm_term=Vm%E5%AE%89%E8%A3%85centos&spm=1018.2226.3001.4187">超详细VMware安装CentOs图文教程</a></p>
</li>
<li><p>网络映射端口:<a target="_blank" rel="noopener" href="https://blog.csdn.net/qq_45847507/article/details/126221191?ops_request_misc=%7B%22request_id%22:%22169372371616800225525043%22,%22scm%22:%2220140713.130102334..%22%7D&request_id=169372371616800225525043&biz_id=0&utm_medium=distribute.pc_search_result.none-task-blog-2~all~top_positive~default-1-126221191-null-null.142%5Ev93%5EchatgptT3_1&utm_term=xshell%E8%BF%9E%E6%8E%A5vmware%E8%99%9A%E6%8B%9F%E6%9C%BA&spm=1018.2226.3001.4187">使用XShell连接VMware虚拟机</a></p>
</li>
<li><p><a target="_blank" rel="noopener" href="https://blog.csdn.net/qq_40965479/article/details/118398674?ops_request_misc=%7B%22request_id%22:%22169374816416800226574270%22,%22scm%22:%2220140713.130102334..%22%7D&request_id=169374816416800226574270&biz_id=0&utm_medium=distribute.pc_search_result.none-task-blog-2~all~top_click~default-1-118398674-null-null.142%5Ev93%5EchatgptT3_1&utm_term=centos7ping%E4%B8%8D%E4%BA%86%E7%99%BE%E5%BA%A6&spm=1018.2226.3001.4187">Centos7网络</a></p>
</li>
</ul>
<figure class="highlight bash"><table><tr><td class="code"><pre><span class="line">TYPE=Ethernet</span><br><span class="line">PROXY_METHOD=none</span><br><span class="line">BROWSER_ONLY=no</span><br><span class="line">BOOTPROTO=<span class="string">&quot;static&quot;</span></span><br><span class="line">DEFROUTE=<span class="built_in">yes</span></span><br><span class="line">IPV4_FAILURE_FATAL=no</span><br><span class="line">IPV6INIT=<span class="built_in">yes</span></span><br><span class="line">IPV6_AUTOCONF=<span class="built_in">yes</span></span><br><span class="line">IPV6_DEFROUTE=<span class="built_in">yes</span></span><br><span class="line">IPV6_FAILURE_FATAL=no</span><br><span class="line">IPV6_ADDR_GEN_MODE=stable-privacy</span><br><span class="line">NAME=ens33</span><br><span class="line">UUID=70d5c260-b51c-4fad-ab47-ce385187d7d8</span><br><span class="line">DEVICE=ens33</span><br><span class="line">ONBOOT=<span class="built_in">yes</span></span><br><span class="line">IPADDR=192.168.238.3</span><br><span class="line">NETMASK=255.255.255.0</span><br><span class="line">PREFIX=24</span><br><span class="line">GATEWAY=192.168.238.2</span><br><span class="line">DNS1=114.114.114.114</span><br></pre></td></tr></table></figure>



<br/>

<br/>

<hr>
<br/>

<br/>



<h1 id="常见命令"><a href="#常见命令" class="headerlink" title="常见命令"></a>常见命令</h1><blockquote>
<p><strong>关机</strong></p>
</blockquote>
<p>关机指令为：shutdown</p>
<figure class="highlight bash"><table><tr><td class="code"><pre><span class="line"><span class="built_in">sync</span>		<span class="comment">#将数据由内存周步到硬盘中。---首先要运行sync命令，把内存中的数据写到磁盘中。</span></span><br><span class="line">shutdown		<span class="comment">#关机指令，你可以man shutdown来看一下帮助文档。例如你可以运行如下命令关机：</span></span><br><span class="line">shutdown -h 10		<span class="comment">#这个命令告诉大家，计算机将在10分钟后关机</span></span><br><span class="line">shutdown -h now		<span class="comment">#立马关机</span></span><br><span class="line">shutdown -h 20：25	<span class="comment">#系统会在今天20：25关机</span></span><br><span class="line">shutdown -h +10		<span class="comment">#十分钟后关机</span></span><br><span class="line">shutdown -r now		<span class="comment">#系统立马重启</span></span><br><span class="line">shutdown -r +10		<span class="comment">#系统十分钟后重启</span></span><br><span class="line">reboot		<span class="comment">#就是重启，等同于shutdown-rnow</span></span><br><span class="line">halt		<span class="comment">#关闭系统，等同于shutdown-hnow和poweroff</span></span><br></pre></td></tr></table></figure>

<br/>

<blockquote>
<p><strong>系统目录结构</strong></p>
</blockquote>
<p>登录系统后，在当前命令窗口下输入命令：</p>
<figure class="highlight bash"><table><tr><td class="code"><pre><span class="line"><span class="comment">#查看目录</span></span><br><span class="line"><span class="built_in">ls</span> /</span><br></pre></td></tr></table></figure>

<p>树状目录结构：</p>
<p><img src= "" data-lazy-src="/img/loading.gif" data-original="https://chen-1317386995.cos.ap-guangzhou.myqcloud.com/Blog/images/image-20230813203439489.png" alt="image-20230813203439489"></p>
<ul>
<li><strong>&#x2F;bin</strong>：bin是Binary的缩写，这个目录存放着最经常使用的命令。</li>
<li><strong>&#x2F;boot</strong>：这里存放的是启动iux时使用的一些核心文件，包括一些连接文件以及镜像文件。</li>
<li><strong>&#x2F;dev</strong>：dev是Device(设备)的缩写，存放的是Linux的外部设备，在Linux中访问设备的方式和访问文件的方式是相同的。</li>
<li><a style="color:#71afe5"><strong>&#x2F;etc</strong>：这个目录用来存放所有的系统管理所需要的配置文件和子目录。</a></li>
<li><a style="color:#71afe5"><strong>&#x2F;home</strong>：用户的主目录，在Liux中，每个用户都有一个自己的目录，一般该目录名是以用户的账号命名的。</a></li>
<li><strong>&#x2F;ib</strong>：这个目录里存放着系统最基本的动态连接共享库，其作用类似于Windows.里的DLL文件。</li>
<li><strong>&#x2F;lost+foud</strong>：这个目录一般情况下是空的，当系统非法关机后，这里就存放了一些文件。</li>
<li><strong>&#x2F;media</strong>：linux系统会自动识别一些设备，例如U盘、光驱等等，当识别后，linux会把识别的设备挂载到这个目录下。</li>
<li><strong>&#x2F;mnt</strong>：系统提供该目录是为了让用户临时挂载别的文件系统的，我们可以将光驱挂载在&#x2F;mt&#x2F;上，然后进入该目录就可以查看光驱里的内容了。</li>
<li><a style="color:red"><strong>&#x2F;opt</strong>：这是给主机额外安装软件所摆放的目录。比如你安装一个ORACLE数据库则就可以放到这个目录下。默认是空的。</a></li>
<li><strong>&#x2F;opt</strong>：这个目录是一个虚拟的目录，它是系统内存的映射，我们可以通过直接访问这个目录来获取系统信息。</li>
<li><strong>&#x2F;root</strong>：该目录为系统管理员，也称作超级权限者的用户主目录。</li>
<li><strong>&#x2F;sbin</strong>：s就是Super User的意思，这里存放的是系统管理员使用的系统管理程序。</li>
<li><strong>&#x2F;srv</strong>：该目录存放一些服务启动之后需要提取的数据。</li>
<li><strong>&#x2F;sys</strong>：这是Iiux2.6内核的一个很大的变化。该目录下安装了2.6内核中新出现的一个文件系统sysfs。</li>
<li><a style="color:#71afe5"><strong>&#x2F;tmp</strong>：文个目录是用来存放一些临时文件的</a></li>
<li><a style="color:red"><strong>&#x2F;usr</strong>：这是一个非常重要的目录，用户的很多应用程序和文件都放在这个目录下，类似于windows下的orogram files目录。</a></li>
<li><strong>&#x2F;usr&#x2F;bin</strong>：系统用户使用的应用程序。</li>
<li><strong>&#x2F;usr&#x2F;sbin</strong>：超级用户使用的比较高级的管理程序和系统守护程序。Super</li>
<li><strong>&#x2F;usr&#x2F;sc</strong>：内核源代码默认的放置目录。</li>
<li><strong>&#x2F;var</strong>：这个目录中存放着在不断扩充着的东西，我们习惯将那些经常被修改的目录放在这个目录下。包括各种日志文件。</li>
<li><strong>&#x2F;run</strong>：是一个临时文件系统，存储系统启动以来的信息。当系统重启时，这个目录下的文件应该被删掉或清除。</li>
<li><a style="color:red"><strong>&#x2F;www</strong>：存放服务器网站相关的资源，环境，网站的项目</a></li>
</ul>
<br/>

<hr>
<br/>

<h2 id="目录管理"><a href="#目录管理" class="headerlink" title="目录管理"></a>目录管理</h2><blockquote>
<p><strong>cd</strong> 切换目录</p>
</blockquote>
<figure class="highlight bash"><table><tr><td class="code"><pre><span class="line"><span class="built_in">cd</span> 目录名		<span class="comment">#进入目录</span></span><br><span class="line"><span class="built_in">cd</span> ../目录		<span class="comment">#相对路径进入目录</span></span><br><span class="line"><span class="built_in">cd</span> /目录		<span class="comment">#绝对路径进入目录</span></span><br><span class="line"><span class="built_in">cd</span> ~ 		 <span class="comment">#回到当前用户目录</span></span><br></pre></td></tr></table></figure>

<br/>

<blockquote>
<p><strong>pwd</strong>  获取当前所在目录</p>
</blockquote>
<figure class="highlight bash"><table><tr><td class="code"><pre><span class="line"><span class="built_in">pwd</span>		<span class="comment">#获取当前所在目录</span></span><br></pre></td></tr></table></figure>

<br/>

<blockquote>
<p><strong>ls</strong>		#列出目录</p>
</blockquote>
<figure class="highlight bash"><table><tr><td class="code"><pre><span class="line"><span class="built_in">ls</span> -a		<span class="comment">#查看全部的文件，包括隐藏文件</span></span><br><span class="line"><span class="built_in">ls</span> -l		<span class="comment">#列出所有的文件，包含文件的属性和权限，没有隐藏文件</span></span><br><span class="line"><span class="built_in">ls</span> -al		<span class="comment">#隐藏+所有</span></span><br></pre></td></tr></table></figure>

<br/>

<blockquote>
<p><strong>mkdir</strong>  创建一个目录</p>
</blockquote>
<figure class="highlight bash"><table><tr><td class="code"><pre><span class="line"><span class="built_in">mkdir</span> test1		<span class="comment">#创建目录</span></span><br><span class="line"><span class="built_in">mkdir</span> -p 目录1/目录2/目录3	<span class="comment">#递归创建目录</span></span><br></pre></td></tr></table></figure>

<br/>

<blockquote>
<p><strong>rmdir</strong> 删除目录</p>
</blockquote>
<figure class="highlight bash"><table><tr><td class="code"><pre><span class="line"><span class="built_in">rmdir</span> test1		<span class="comment">#删除目录，只能删除空目录</span></span><br><span class="line"><span class="built_in">rmdir</span> -p 目录1/目录2/目录3	<span class="comment">#删除层级目录</span></span><br></pre></td></tr></table></figure>

<p>rmdir仅能删除空的目录，如果下面存在文件，需要先删除文件，递归删除多个目录p参数即可</p>
<br/>

<blockquote>
<p><strong>cp</strong>  复制文件或目录</p>
</blockquote>
<figure class="highlight bash"><table><tr><td class="code"><pre><span class="line"><span class="built_in">cp</span> 原来的地方 新的地方</span><br></pre></td></tr></table></figure>

<br/>

<blockquote>
<p><strong>rm</strong>	移除文件或者目录</p>
</blockquote>
<p>-f  忽略不存在的文件，不会出现警告，强制删除！<br>        -r  递归删除目录！<br>        -i  互动，删除询问是否删除</p>
<figure class="highlight bash"><table><tr><td class="code"><pre><span class="line"><span class="built_in">rm</span> -rf 文件   <span class="comment">#系统中所有的文件就被删除了</span></span><br><span class="line"><span class="built_in">rm</span> -rf /   <span class="comment">#系统中所有的文件就被删除了</span></span><br></pre></td></tr></table></figure>

<br/>

<blockquote>
<p><strong>mv</strong>	移动文件</p>
</blockquote>
<p>​	  -f      强制<br>​			-u	只替换已经更新过的文件</p>
<figure class="highlight bash"><table><tr><td class="code"><pre><span class="line"><span class="built_in">mv</span> 文件 文件夹/	<span class="comment">#移动文件</span></span><br><span class="line"><span class="built_in">mv</span> name1 name2		<span class="comment">#重命名文件夹</span></span><br></pre></td></tr></table></figure>

<br/>

<br/>

<hr>
<br/>

<br/>

<h2 id="基本属性"><a href="#基本属性" class="headerlink" title="基本属性"></a>基本属性</h2><p><img src= "" data-lazy-src="/img/loading.gif" data-original="https://chen-1317386995.cos.ap-guangzhou.myqcloud.com/Blog/images/image-20230813214032365.png" alt="image-20230813214032365"></p>
<p>实例中，boot文件的<strong>第一个属性用”d”表示</strong>。”d”在LiuX中代表该文件是一个<strong>目录文件</strong>。</p>
<p>在Liux中<strong>第一个字符代表这个文件是目录、文件或链接文件</strong>等等：</p>
<ul>
<li>[ <strong>d</strong> ]	则是目录</li>
<li>[ <strong>-</strong> ]     则是文件；</li>
<li>[ <strong>l</strong> ]     则表示为链接文档(link file)，快捷方式</li>
<li>[ <strong>b</strong> ]    则表示为装置文件里面的可供储存的接口设备（可随机存取装置）；</li>
<li>[ <strong>c</strong> ]     则表示为装置文件里面的串行端口设备，例如键盘、鼠标（一次性读取装置）。</li>
</ul>
<p>接下来的字符中，以三个为一组，且均为『rwx』的三个参数的组合。其中<a style="color:#71afe5"><strong>[ r ]代表可读(read)、[ w ]代表可写(write)、[ x ]代表可执行(execute)</strong></a>。要注意的是，这三个权限的位置不会改变，<strong>如果没有权限，就险出现减号[-]而已</strong>。</p>
<p><img src= "" data-lazy-src="/img/loading.gif" data-original="https://chen-1317386995.cos.ap-guangzhou.myqcloud.com/Blog/images/image-20230813213611576.png" alt="image-20230813213611576"></p>
<br/>



<br/>

<blockquote>
<p>修改文件属性</p>
</blockquote>
<p><strong>1、chgrp：更改文件属组</strong></p>
<figure class="highlight bash"><table><tr><td class="code"><pre><span class="line">chargp [-R] 数组名 文件名</span><br></pre></td></tr></table></figure>

<p>-R:递归更改文件属组，就是在更改某个目录文件的属组时，如果加上-R的参数，那么该目录下的所有文件的属组都会更改。</p>
<br/>

<p><strong>2、chown:更改文件属主，也可以同时更改文件属组</strong></p>
<figure class="highlight bash"><table><tr><td class="code"><pre><span class="line"><span class="built_in">chown</span> -R  属主名  文件名</span><br><span class="line"><span class="built_in">chown</span> -R  属主名：属组名  文件名</span><br></pre></td></tr></table></figure>

<br/>

<p><strong>3、chmod:更改文件9个属性【*】</strong></p>
<figure class="highlight bash"><table><tr><td class="code"><pre><span class="line"><span class="built_in">chmod</span> [-R] xyz 文件或目录</span><br></pre></td></tr></table></figure>

<p>Liux文件属性有两种设置方法，一种是数字，一种是符号。</p>
<p>Linux文件的基本权限就有九个，分别是owner&#x2F;group&#x2F;others:三种身份各有自己的read&#x2F;write&#x2F;execute权限。</p>
<p>文件的权限字符为：『-rwxrwxrwx』，这九个权限是三个三个一组的！其中，我们可以使用数字来代表各个权限，各权限的分数对照表如下</p>
<figure class="highlight bash"><table><tr><td class="code"><pre><span class="line">r:4	w:2	x:1</span><br></pre></td></tr></table></figure>

<br/>

<p>每种身份(owner&#x2F;group&#x2F;others)各自的三个权限(r&#x2F;w&#x2F;x)分数是需要累加的，例如当权限为：[ -rwxrwx— ]分数则是：</p>
<ul>
<li>owner &#x3D; rwx &#x3D;4+2+1&#x3D;7</li>
<li>group &#x3D; rwx &#x3D;4+2+1&#x3D;7</li>
<li>others &#x3D; —  &#x3D;0+0+0&#x3D;0</li>
</ul>
<figure class="highlight bash"><table><tr><td class="code"><pre><span class="line"><span class="built_in">chmod</span> 770 fileName</span><br></pre></td></tr></table></figure>



<br/> 

<br/>

<hr>
<br/>

<br/>

<h2 id="文件内容查看"><a href="#文件内容查看" class="headerlink" title="文件内容查看"></a>文件内容查看</h2><ul>
<li><strong>cat</strong>	由第一行开始显示文件内容</li>
<li><strong>tac</strong>	从最后一行开始显示，可以看出tac是cat的倒着写！</li>
<li><strong>nl</strong>	显示的时候，顺道输出行号！</li>
<li><strong>more</strong>	一页一页的显示文件内容,(空格代表翻页，enter代表向下看一行，：f行号)</li>
<li><strong>less</strong>  与 mor e类似，但是比more更好的是，他可以往前翻页！（空格下翻页，pageDown,pageUp键代表翻动页面！退出q命令，查找字符串 &#x2F; 要查询的字符向下查询，向上查询使用 ？,n继续查找下一个，N向上)</li>
<li><strong>head</strong>	只看头几行,通过-n参数来控制显示几行 (head -n 20 filename)</li>
<li><strong>tail</strong>	只看尾巴几行I,,通过-n参数来控制显示几行 (tail-n 20 filename)</li>
</ul>
<br/>

<br/>

<br/>

<br/>



<h2 id="防火墙"><a href="#防火墙" class="headerlink" title="防火墙"></a>防火墙</h2><figure class="highlight bash"><table><tr><td class="code"><pre><span class="line"><span class="comment">#查看firewall服务状态</span></span><br><span class="line">systemctl status firewalld</span><br><span class="line"></span><br><span class="line"><span class="comment">#开启、重启、关闭、firewalld.service服务</span></span><br><span class="line"><span class="comment">#开启</span></span><br><span class="line">service firewalld start</span><br><span class="line"></span><br><span class="line"><span class="comment">#重启</span></span><br><span class="line">service firewalld restart</span><br><span class="line"></span><br><span class="line"><span class="comment">#关闭</span></span><br><span class="line">service firewalld stop</span><br><span class="line"></span><br><span class="line"><span class="comment">#查看防火墙规则</span></span><br><span class="line">firewall--cmd-list-all<span class="comment">#查看全部信息</span></span><br><span class="line">firewall-cmd-list-ports<span class="comment">#只看端口信息</span></span><br><span class="line"></span><br><span class="line"><span class="comment">#开启端口</span></span><br><span class="line">f端口命令：firewall--cmd-zone=public-add-port=80/tcp-permanent</span><br><span class="line">重启防火墙：systemctl restart firewalld.service</span><br><span class="line"></span><br><span class="line">命令含义：</span><br><span class="line">-Zone<span class="comment">#作用域</span></span><br><span class="line">-ādd-port=80/tcp<span class="comment">#添加端口，格式为：端口/通讯协议</span></span><br><span class="line">-permanent<span class="comment">#永久生效，没有此参数重启后失效</span></span><br></pre></td></tr></table></figure>

<figure class="highlight bash"><table><tr><td class="code"><pre><span class="line"><span class="comment">#开启防火墙端口</span></span><br><span class="line">firewal1-cmd --zone=public --add-port=9000/tcp --permanent</span><br><span class="line"></span><br><span class="line"><span class="comment">#重启防火墙</span></span><br><span class="line">systemctl restart firewalld.service</span><br></pre></td></tr></table></figure>

<br/>

<br/>

<hr>
<br/>

<br/>

<h1 id="Vim编译器"><a href="#Vim编译器" class="headerlink" title="Vim编译器"></a>Vim编译器</h1><p><img src= "" data-lazy-src="/img/loading.gif" data-original="https://chen-1317386995.cos.ap-guangzhou.myqcloud.com/Blog/images/image-20230814001129130.png" alt="image-20230814001129130"></p>
<figure class="highlight bash"><table><tr><td class="code"><pre><span class="line"><span class="comment"># 进入文件 -》 命令模式  -》i 输入模式 -》（Esc退出输入模式） 按 ： 进入底线命令模式 -》 wq（保存退出编译器）</span></span><br><span class="line"></span><br><span class="line">vim fileName.<span class="built_in">type</span>		<span class="comment">#打开文件，文件不存在则创建</span></span><br><span class="line"></span><br></pre></td></tr></table></figure>

<br/>

<blockquote>
<p>三种使用模式</p>
</blockquote>
<p>基本上vi&#x2F;wim共分为三种模式，分别是<strong>命令模式(Command mode)</strong>,**输入模式(Insert mode)<strong>和</strong>底线命令模式(Last line mode)**。这三种模式的作用分别是：</p>
<br/>

<p><strong>命令模式：</strong><br>I用户刚刚启动vi&#x2F;vim,便进入了命令模式。<br>此状态下敲击键盘动作会被Vi识别为命令，而非输入字符。比如我们此时按下i,并不会输入一个字符，被当作了一个命令。<br>以下是常用的几个命令：</p>
<ul>
<li><strong>i</strong>  切换到输入模式，以输入字符。</li>
<li><strong>x</strong>  删除当前光标所在处的字符。</li>
<li><strong>:</strong>  切换到底线命令模式，以在最底一行输入命令。如果是编辑模式，需要先<strong>退出编辑模式 ESC</strong>！</li>
</ul>
<br/>

<br/>

<p><strong>输入模式：</strong></p>
<p>在命令模式下按下就进入了输入模式。</p>
<ul>
<li><strong>字符按键以及Shift组合</strong>，输入字符</li>
<li><strong>ENTER</strong>,回车键，换行</li>
<li><strong>BACK SPACE</strong>,退格键，删除光标前一个字符</li>
<li><strong>DEL</strong>,删除键，删除光标后一个字符</li>
<li><strong>方向键</strong>，在文本中移动光标</li>
<li><strong>HOME&#x2F;END</strong>,移动光标到行首&#x2F;行尾</li>
<li><a style="color:#71afe5"><strong>ESC</strong> 退出输入模式进入命令模式</a></li>
</ul>
<blockquote>
<p><img src= "" data-lazy-src="/img/loading.gif" data-original="https://chen-1317386995.cos.ap-guangzhou.myqcloud.com/Blog/images/image-20230814001836277.png" alt="image-20230814001836277"></p>
</blockquote>
<br/>

<br/>



<p><strong>底线命令模式</strong><br>在<strong>命令模式下按下</strong>  <strong>：</strong>（<strong>英文冒号</strong>）就进入了底线命令模式。光标就移动到了最底下，就可以在这里输入一些底线命了！<br>在底线命令模式中，基本的命令有（已经省略了冒号）：</p>
<ul>
<li>q退出程序</li>
<li>w保存文件</li>
<li><a style="color:#71afe5"><strong>wq 保存后退出</strong></a></li>
</ul>
<p>按ESC键可随时退出底线命令模式。</p>
<blockquote>
<p><img src= "" data-lazy-src="/img/loading.gif" data-original="https://chen-1317386995.cos.ap-guangzhou.myqcloud.com/Blog/images/%E9%95%BF%E5%9B%BE_2023-08-14.png" alt="长图_2023-08-14"></p>
<p><img src= "" data-lazy-src="/img/loading.gif" data-original="https://chen-1317386995.cos.ap-guangzhou.myqcloud.com/Blog/images/image-20230814001702202.png" alt="image-20230814001702202"></p>
<p><img src= "" data-lazy-src="/img/loading.gif" data-original="https://chen-1317386995.cos.ap-guangzhou.myqcloud.com/Blog/images/image-20230814001724187.png" alt="image-20230814001724187"></p>
</blockquote>
<blockquote>
<p><img src= "" data-lazy-src="/img/loading.gif" data-original="https://chen-1317386995.cos.ap-guangzhou.myqcloud.com/Blog/images/image-20230814001911137.png" alt="image-20230814001911137"></p>
</blockquote>
<br/>

<br/>

<hr>
<br/>

<br/>

<h1 id="账号管理"><a href="#账号管理" class="headerlink" title="账号管理"></a>账号管理</h1><blockquote>
<p><strong>useradd</strong>  命令添加用户</p>
</blockquote>
<p>useradd -m  选项用户名</p>
<p>自动创建这个用户的主目录 home&#x2F;选项用户名</p>
<figure class="highlight bash"><table><tr><td class="code"><pre><span class="line">useradd -m peng		<span class="comment">#创建用户</span></span><br><span class="line">passwd			     <span class="comment">#当前普通用户设置密码</span></span><br><span class="line"></span><br><span class="line">passwd 用户			    <span class="comment">#root 下为用户设置密码</span></span><br></pre></td></tr></table></figure>

<p>查看： cat &#x2F;etc&#x2F;passwd</p>
<br/>

<blockquote>
<p><strong>userdel</strong>  删除用户</p>
</blockquote>
<p>userdel -r 用户名</p>
<p>删除用户的时候将他的目录页一并删掉！</p>
<figure class="highlight bash"><table><tr><td class="code"><pre><span class="line">userdel -r peng		<span class="comment">#删除用户</span></span><br></pre></td></tr></table></figure>

<br/>

<blockquote>
<p><strong>usermod</strong>	修改用户</p>
</blockquote>
<p>usermod 修改内容 <strong>用户名</strong></p>
<figure class="highlight bash"><table><tr><td class="code"><pre><span class="line">usermod -d /home/223 peng		<span class="comment">#修改peng账号转到233文件夹</span></span><br></pre></td></tr></table></figure>

<br/>

<blockquote>
<p><strong>切换用户</strong></p>
</blockquote>
<p>root用户</p>
<p>1.切换用户的命令为：<strong>su 用户名</strong></p>
<p>2.从普通用户切换到root用户，还可以使用命令：sudo su</p>
<p>3.在终端输入exit或logouti或使用快捷方式ctrl+d,可以退回到原来用户，其实ctrl+d也是执行的exit命</p>
<p>4.在切换用户时，如果想在切换用户之后使用新用户的工作环境，可以在su和username之间加-，例如：【su-root】		$表示普通用户</p>
<p>#表示超级用户，也就是root用户</p>
<br/>

<blockquote>
<p>锁定账户</p>
</blockquote>
<figure class="highlight bash"><table><tr><td class="code"><pre><span class="line">passwd -l 账户</span><br></pre></td></tr></table></figure>

<br/>

<br/>

<hr>
<br/>

<br/>



<h1 id="磁盘管理"><a href="#磁盘管理" class="headerlink" title="磁盘管理"></a>磁盘管理</h1><blockquote>
<p><strong>df</strong>   (列出文件系统整体的磁盘使用量)</p>
</blockquote>
<figure class="highlight bash"><table><tr><td class="code"><pre><span class="line"><span class="built_in">df</span></span><br><span class="line"><span class="built_in">df</span> -h <span class="comment">#显示单位M</span></span><br></pre></td></tr></table></figure>



<p><img src= "" data-lazy-src="/img/loading.gif" data-original="https://chen-1317386995.cos.ap-guangzhou.myqcloud.com/Blog/images/image-20230814205901570.png" alt="image-20230814205901570"></p>
<blockquote>
<p><strong>du</strong>	(检查磁盘空间使用量！)</p>
</blockquote>
<figure class="highlight bash"><table><tr><td class="code"><pre><span class="line"><span class="built_in">du</span>  </span><br><span class="line"><span class="built_in">du</span> -a 	<span class="comment">#查看全部文件包括隐藏文件</span></span><br><span class="line"><span class="built_in">du</span> -sm /*	<span class="comment">#查看根目录下每个目录所占用的容量</span></span><br></pre></td></tr></table></figure>

<p><img src= "" data-lazy-src="/img/loading.gif" data-original="https://chen-1317386995.cos.ap-guangzhou.myqcloud.com/Blog/images/image-20230814210042090.png" alt="image-20230814210042090"></p>
<br/>

<br/>

<hr>
<br/>

<br/>

<h1 id="用户组管理"><a href="#用户组管理" class="headerlink" title="用户组管理"></a>用户组管理</h1><blockquote>
<p>创建一个用户组    <strong>groupadd</strong></p>
</blockquote>
<figure class="highlight bash"><table><tr><td class="code"><pre><span class="line">groupadd 用户名 	<span class="comment">#创建用户组</span></span><br><span class="line">groupadd -g 指定<span class="built_in">id</span> 用户名	<span class="comment">#创建指定id的用户组，默认自增</span></span><br><span class="line"></span><br><span class="line"><span class="built_in">cat</span> /etc/group	<span class="comment">#查看全部用户组</span></span><br></pre></td></tr></table></figure>

<br/>

<blockquote>
<p>删除用户组  <strong>groupdel</strong></p>
</blockquote>
<figure class="highlight bash"><table><tr><td class="code"><pre><span class="line">groupdel 用户名		<span class="comment">#删除指定用户</span></span><br></pre></td></tr></table></figure>

<br/>

<blockquote>
<p>修改用户组  <strong>groupmod -g -n</strong></p>
</blockquote>
<figure class="highlight bash"><table><tr><td class="code"><pre><span class="line">group -g 用户组<span class="built_in">id</span> -n 新名字 旧名字</span><br></pre></td></tr></table></figure>

<br/>

<blockquote>
<p>文件的查看</p>
</blockquote>
<p>&#x2F;etc&#x2F;passwd</p>
<figure class="highlight bash"><table><tr><td class="code"><pre><span class="line">用户名：口令（登录密码，我们不可见）：用户标识号：组标识号：注释性描述：主目录：登录she11</span><br></pre></td></tr></table></figure>



<br/>

<br/>

<hr>
<br/>

<br/>

<h1 id="进程管理"><a href="#进程管理" class="headerlink" title="进程管理"></a>进程管理</h1><blockquote>
<p><strong>ps</strong> 	查看当前系统中正在执行的各种进程的信息！</p>
</blockquote>
<p><strong>ps -xx</strong></p>
<ul>
<li><strong>-a</strong>  ：显示当前终端运行的所有的进程信息（当前的进程一个)</li>
<li><strong>-u</strong>  ：以用户的信息显示进程</li>
<li><strong>-x</strong>  ：显示后台运行进程的参数！</li>
</ul>
<figure class="highlight bash"><table><tr><td class="code"><pre><span class="line"><span class="comment"># ps -aux	查看所有的进程</span></span><br><span class="line">ps -aux|grep mysql</span><br><span class="line"><span class="comment"># | 在Linux:这个叫做管道符	A|B</span></span><br><span class="line"><span class="comment">#grep查找文件中符合条件的字符串！</span></span><br></pre></td></tr></table></figure>

<p><strong>ps -xx|grep 进程名字</strong>    过滤进程信息！</p>
<br/>

<p><strong>ps -ef</strong>  ：可以查看到父进程的信息</p>
<figure class="highlight bash"><table><tr><td class="code"><pre><span class="line">ps-ef|grep mysq1	<span class="comment">#看父进程我们一般可以通过目录树结构来查看！</span></span><br><span class="line"></span><br><span class="line"><span class="comment">#进程树</span></span><br><span class="line">pstree -pu</span><br><span class="line">	  -p 显示父<span class="built_in">id</span></span><br><span class="line">	  -u 显示用户组</span><br></pre></td></tr></table></figure>

<br/>

<br/>

<blockquote>
<p><strong>kill -9 进程的id</strong>		结束进程</p>
</blockquote>
<br/>

<br/>

<hr>
<br/>

<br/>

<h1 id="环境安装"><a href="#环境安装" class="headerlink" title="环境安装"></a>环境安装</h1><ul>
<li>rpm</li>
<li>解压缩</li>
<li>yum在线安装</li>
</ul>
<br/>

<h2 id="rpm"><a href="#rpm" class="headerlink" title="rpm"></a>rpm</h2><p><strong>JDK</strong></p>
<p><a target="_blank" rel="noopener" href="https://www.oracle.com/java/technologies/javase/javase8-archive-downloads.html">Java Archive Downloads - Java SE 8 (oracle.com)</a></p>
<figure class="highlight bash"><table><tr><td class="code"><pre><span class="line">rpm -ivh rpm包 --force --nodeps</span><br></pre></td></tr></table></figure>

<figure class="highlight plaintext"><table><tr><td class="code"><pre><span class="line">export JAVA_HOME=/usr/local/java/jdk1.8.0_202</span><br><span class="line">export JRE_HOME=$&#123;JAVA_HOME&#125;/jre</span><br><span class="line">export CLASSPATH=.:$&#123;JAVA_HOME&#125;/lib:$&#123;JRE_HOME&#125;/lib</span><br><span class="line">export PATH=$&#123;JAVA_HOME&#125;/bin:$PATH</span><br></pre></td></tr></table></figure>



<br/>

<br/>

<h2 id="zip"><a href="#zip" class="headerlink" title="zip"></a>zip</h2><p><strong>Tomcat</strong></p>
<ul>
<li>解压</li>
</ul>
<figure class="highlight bash"><table><tr><td class="code"><pre><span class="line">tar -zxvf  **</span><br></pre></td></tr></table></figure>

<ul>
<li>启动</li>
</ul>
<figure class="highlight bash"><table><tr><td class="code"><pre><span class="line"><span class="comment">#进入Tomcat目录 -》 bin 目录 -》</span></span><br><span class="line"><span class="comment"># ./xxx.sh脚本即可运行</span></span><br><span class="line"></span><br><span class="line"><span class="comment">#执行</span></span><br><span class="line">./startup.sh</span><br><span class="line"></span><br><span class="line"><span class="comment">#停止  </span></span><br><span class="line">./shotdown.sh</span><br><span class="line"></span><br></pre></td></tr></table></figure>



<br/>

<br/>

<h2 id="yum"><a href="#yum" class="headerlink" title="yum"></a>yum</h2><p><strong>Docker</strong></p>
<p><a target="_blank" rel="noopener" href="https://docs.docker.com/engine/install/centos/">Install Docker Engine on CentOS | Docker Documentation</a></p>
<ul>
<li>安装命令</li>
</ul>
<figure class="highlight bash"><table><tr><td class="code"><pre><span class="line">yum -y install 	<span class="comment">#yum insta11安装命令-y所有的提示都为y</span></span><br><span class="line"></span><br><span class="line">1、</span><br><span class="line">sudo yum install -y yum-utils</span><br><span class="line">sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo</span><br><span class="line"></span><br><span class="line">2、</span><br><span class="line">yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo</span><br><span class="line"></span><br><span class="line">3、更新yum软件包索引</span><br><span class="line">yum makecache fast</span><br><span class="line"></span><br><span class="line">4、安装Docker CE</span><br><span class="line">yum -y install docker-ce docker-ce-cli containerd.io</span><br><span class="line"></span><br><span class="line">5、启动docker</span><br><span class="line">systemctl start docker</span><br><span class="line"></span><br><span class="line">6、测试</span><br><span class="line">docker version</span><br><span class="line">docker run hello-world</span><br><span class="line">docker images</span><br></pre></td></tr></table></figure>

</article><div class="post-copyright"><div class="post-copyright__author"><span class="post-copyright-meta">文章作者: </span><span class="post-copyright-info"><a href="http://example.com">辰</a></span></div><div class="post-copyright__type"><span class="post-copyright-meta">文章链接: </span><span class="post-copyright-info"><a href="http://example.com/2023/05/05/Linux/">http://example.com/2023/05/05/Linux/</a></span></div><div class="post-copyright__notice"><span class="post-copyright-meta">版权声明: </span><span class="post-copyright-info">本博客所有文章除特别声明外，均采用 <a href="https://creativecommons.org/licenses/by-nc-sa/4.0/" target="_blank">CC BY-NC-SA 4.0</a> 许可协议。转载请注明来自 <a href="http://example.com" target="_blank">C·辰</a>！</span></div></div><div class="tag_share"><div class="post-meta__tag-list"><a class="post-meta__tags" href="/tags/Linux/">Linux</a></div><div class="post_share"><div class="social-share" data-image="https://chen-1317386995.cos.ap-guangzhou.myqcloud.com/Blog/images/Linux.jpg" data-sites="wechat,qq"></div><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/butterfly-extsrc/sharejs/dist/css/share.min.css" media="print" onload="this.media='all'"><script src="https://cdn.jsdelivr.net/npm/butterfly-extsrc/sharejs/dist/js/social-share.min.js" defer></script></div></div><nav class="pagination-post" id="pagination"><div class="prev-post pull-left"><a href="/2023/05/05/Redis/" title="Redis"><img class="cover" src= "" data-lazy-src="/img/loading.gif" data-original="ttps://chen-1317386995.cos.ap-guangzhou.myqcloud.com/Blog/images/Redis.jpeg" onerror="onerror=null;src='/img/404.jpg'" alt="cover of previous post"><div class="pagination-info"><div class="label">上一篇</div><div class="prev_info">Redis</div></div></a></div><div class="next-post pull-right"><a href="/2023/06/02/MybatisPlus/" title="MybatisPlus"><img class="cover" src= "" data-lazy-src="/img/loading.gif" data-original="https://chen-1317386995.cos.ap-guangzhou.myqcloud.com/Blog/images/mybatisplus.svg" onerror="onerror=null;src='/img/404.jpg'" alt="cover of next post"><div class="pagination-info"><div class="label">下一篇</div><div class="next_info">MybatisPlus</div></div></a></div></nav></div><div class="aside-content" id="aside-content"><div class="card-widget card-info"><div class="is-center"><div class="avatar-img"><img src= "" data-lazy-src="/img/loading.gif" data-original="https://chen-1317386995.cos.ap-guangzhou.myqcloud.com/Blog%2Fimages%2Favatar.jpg" onerror="this.onerror=null;this.src='/img/friend_404.gif'" alt="avatar"/></div><div class="author-info__name">辰</div><div class="author-info__description">车遥马慢</div></div><div class="card-info-data site-data is-center"><a href="/archives/"><div class="headline">文章</div><div class="length-num">32</div></a><a href="/tags/"><div class="headline">标签</div><div class="length-num">28</div></a><a href="/categories/"><div class="headline">分类</div><div class="length-num">10</div></a></div><a id="card-info-btn" target="_blank" rel="noopener" href="https://gitee.com/hchenp"><i class="fab fa-github"></i><span>Gitee-HchenP</span></a><div class="card-info-social-icons is-center"><a class="social-icon" href="https://gitee.com/hchenp" target="_blank" title="Github"><i class="fab fa-github"></i></a><a class="social-icon" href="https://github.com/Pxlchen?tab=projects" target="_blank" title="CSDN"><i class="fa fa-book-open"></i></a><a class="social-icon" href="https://console.cloud.tencent.com/cos/bucket?bucket=chen-1317386995&amp;region=ap-guangzhou&amp;isPublic=true" target="_blank" title="QQ"><i class="fab fa-qq"></i></a><a class="social-icon" href="mailto:1107383160@qq.com" target="_blank" title="Email"><i class="fas fa-envelope-open-text"></i></a></div></div><div class="card-widget card-announcement"><div class="item-headline"><i class="fas fa-bullhorn fa-shake"></i><span>公告</span></div><div class="announcement_content">C2C-Blog</div></div><div class="sticky_layout"><div class="card-widget" id="card-toc"><div class="item-headline"><i class="fas fa-stream"></i><span>目录</span><span class="toc-percentage"></span></div><div class="toc-content is-expand"><ol class="toc"><li class="toc-item toc-level-1"><a class="toc-link" href="#Linux"><span class="toc-number">1.</span> <span class="toc-text">Linux</span></a></li><li class="toc-item toc-level-1"><a class="toc-link" href="#%E7%8E%AF%E5%A2%83%E6%90%AD%E5%BB%BA"><span class="toc-number">2.</span> <span class="toc-text">环境搭建</span></a></li><li class="toc-item toc-level-1"><a class="toc-link" href="#%E5%B8%B8%E8%A7%81%E5%91%BD%E4%BB%A4"><span class="toc-number">3.</span> <span class="toc-text">常见命令</span></a><ol class="toc-child"><li class="toc-item toc-level-2"><a class="toc-link" href="#%E7%9B%AE%E5%BD%95%E7%AE%A1%E7%90%86"><span class="toc-number">3.1.</span> <span class="toc-text">目录管理</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E5%9F%BA%E6%9C%AC%E5%B1%9E%E6%80%A7"><span class="toc-number">3.2.</span> <span class="toc-text">基本属性</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E6%96%87%E4%BB%B6%E5%86%85%E5%AE%B9%E6%9F%A5%E7%9C%8B"><span class="toc-number">3.3.</span> <span class="toc-text">文件内容查看</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E9%98%B2%E7%81%AB%E5%A2%99"><span class="toc-number">3.4.</span> <span class="toc-text">防火墙</span></a></li></ol></li><li class="toc-item toc-level-1"><a class="toc-link" href="#Vim%E7%BC%96%E8%AF%91%E5%99%A8"><span class="toc-number">4.</span> <span class="toc-text">Vim编译器</span></a></li><li class="toc-item toc-level-1"><a class="toc-link" href="#%E8%B4%A6%E5%8F%B7%E7%AE%A1%E7%90%86"><span class="toc-number">5.</span> <span class="toc-text">账号管理</span></a></li><li class="toc-item toc-level-1"><a class="toc-link" href="#%E7%A3%81%E7%9B%98%E7%AE%A1%E7%90%86"><span class="toc-number">6.</span> <span class="toc-text">磁盘管理</span></a></li><li class="toc-item toc-level-1"><a class="toc-link" href="#%E7%94%A8%E6%88%B7%E7%BB%84%E7%AE%A1%E7%90%86"><span class="toc-number">7.</span> <span class="toc-text">用户组管理</span></a></li><li class="toc-item toc-level-1"><a class="toc-link" href="#%E8%BF%9B%E7%A8%8B%E7%AE%A1%E7%90%86"><span class="toc-number">8.</span> <span class="toc-text">进程管理</span></a></li><li class="toc-item toc-level-1"><a class="toc-link" href="#%E7%8E%AF%E5%A2%83%E5%AE%89%E8%A3%85"><span class="toc-number">9.</span> <span class="toc-text">环境安装</span></a><ol class="toc-child"><li class="toc-item toc-level-2"><a class="toc-link" href="#rpm"><span class="toc-number">9.1.</span> <span class="toc-text">rpm</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#zip"><span class="toc-number">9.2.</span> <span class="toc-text">zip</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#yum"><span class="toc-number">9.3.</span> <span class="toc-text">yum</span></a></li></ol></li></ol></div></div><div class="card-widget card-recent-post"><div class="item-headline"><i class="fas fa-history"></i><span>最新文章</span></div><div class="aside-list"><div class="aside-list-item"><a class="thumbnail" href="/2023/07/06/Java%E5%85%AB%E8%82%A1%E6%96%87/" title="Java八股文"><img src= "" data-lazy-src="/img/loading.gif" data-original="https://chen-1317386995.cos.ap-guangzhou.myqcloud.com/Blog/images/javaall.gif" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="Java八股文"/></a><div class="content"><a class="title" href="/2023/07/06/Java%E5%85%AB%E8%82%A1%E6%96%87/" title="Java八股文">Java八股文</a><time datetime="2023-07-06T14:22:22.000Z" title="发表于 2023-07-06 22:22:22">2023-07-06</time></div></div><div class="aside-list-item"><a class="thumbnail" href="/2023/07/06/%E5%90%8E%E7%AB%AF%E8%A7%84%E5%88%92/" title="Java后端"><img src= "" data-lazy-src="/img/loading.gif" data-original="https://chen-1317386995.cos.ap-guangzhou.myqcloud.com/Blog/images/javahd.jpeg" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="Java后端"/></a><div class="content"><a class="title" href="/2023/07/06/%E5%90%8E%E7%AB%AF%E8%A7%84%E5%88%92/" title="Java后端">Java后端</a><time datetime="2023-07-06T14:22:22.000Z" title="发表于 2023-07-06 22:22:22">2023-07-06</time></div></div><div class="aside-list-item"><a class="thumbnail" href="/2023/06/02/MybatisPlus/" title="MybatisPlus"><img src= "" data-lazy-src="/img/loading.gif" data-original="https://chen-1317386995.cos.ap-guangzhou.myqcloud.com/Blog/images/mybatisplus.svg" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="MybatisPlus"/></a><div class="content"><a class="title" href="/2023/06/02/MybatisPlus/" title="MybatisPlus">MybatisPlus</a><time datetime="2023-06-02T14:22:22.000Z" title="发表于 2023-06-02 22:22:22">2023-06-02</time></div></div><div class="aside-list-item"><a class="thumbnail" href="/2023/05/05/Linux/" title="Linux"><img src= "" data-lazy-src="/img/loading.gif" data-original="https://chen-1317386995.cos.ap-guangzhou.myqcloud.com/Blog/images/Linux.jpg" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="Linux"/></a><div class="content"><a class="title" href="/2023/05/05/Linux/" title="Linux">Linux</a><time datetime="2023-05-05T14:22:22.000Z" title="发表于 2023-05-05 22:22:22">2023-05-05</time></div></div><div class="aside-list-item"><a class="thumbnail" href="/2023/05/05/Redis/" title="Redis"><img src= "" data-lazy-src="/img/loading.gif" data-original="ttps://chen-1317386995.cos.ap-guangzhou.myqcloud.com/Blog/images/Redis.jpeg" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="Redis"/></a><div class="content"><a class="title" href="/2023/05/05/Redis/" title="Redis">Redis</a><time datetime="2023-05-05T14:22:22.000Z" title="发表于 2023-05-05 22:22:22">2023-05-05</time></div></div></div></div></div></div></main><footer id="footer"><div id="footer-wrap"><div class="copyright">&copy;2020 - 2023 By 辰</div><div class="framework-info"><a target="_blank" rel="noopener" href="https://beian.miit.gov.cn">粤ICP备2023096650号</a><span class="footer-separator">|</span><a target="_blank" rel="noopener" href="http://hchen.cloud">hchen.cloud</a></div></div></footer></div><div id="rightside"><div id="rightside-config-hide"><button id="readmode" type="button" title="阅读模式"><i class="fas fa-book-open"></i></button><button id="darkmode" type="button" title="浅色和深色模式转换"><i class="fas fa-adjust"></i></button><button id="hide-aside-btn" type="button" title="单栏和双栏切换"><i class="fas fa-arrows-alt-h"></i></button></div><div id="rightside-config-show"><button id="rightside_config" type="button" title="设置"><i class="fas fa-cog fa-spin"></i></button><button class="close" id="mobile-toc-button" type="button" title="目录"><i class="fas fa-list-ul"></i></button><button id="go-up" type="button" title="回到顶部"><span class="scroll-percent"></span><i class="fas fa-arrow-up"></i></button></div></div><div><script src="/js/utils.js"></script><script src="/js/main.js"></script><script src="https://cdn.jsdelivr.net/npm/@fancyapps/ui/dist/fancybox/fancybox.umd.min.js"></script><script src="https://cdn.jsdelivr.net/npm/vanilla-lazyload/dist/lazyload.iife.min.js"></script><div class="js-pjax"></div><canvas class="fireworks" mobile="false"></canvas><script src="https://cdn.jsdelivr.net/npm/butterfly-extsrc/dist/fireworks.min.js"></script><script defer="defer" id="fluttering_ribbon" mobile="false" src="https://cdn.jsdelivr.net/npm/butterfly-extsrc/dist/canvas-fluttering-ribbon.min.js"></script><script async data-pjax src="//busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js"></script><div id="local-search"><div class="search-dialog"><nav class="search-nav"><span class="search-dialog-title">搜索</span><span id="loading-status"></span><button class="search-close-button"><i class="fas fa-times"></i></button></nav><div class="is-center" id="loading-database"><i class="fas fa-spinner fa-pulse"></i><span>  数据库加载中</span></div><div class="search-wrap"><div id="local-search-input"><div class="local-search-box"><input class="local-search-box--input" placeholder="搜索文章" type="text"/></div></div><hr/><div class="no-result" id="local-search-results"></div><div id="local-search-stats-wrap"></div></div></div><div id="search-mask"></div><script src="/js/search/local-search.js"></script></div></div>
        <style>
            [bg-lazy] {
                background-image: none !important;
                background-color: #eee !important;
            }
        </style>
        <script>
            window.imageLazyLoadSetting = {
                isSPA: false,
                preloadRatio: 1,
                processImages: null,
            };
        </script><script>window.addEventListener("load",function(){var t=/\.(gif|jpg|jpeg|tiff|png)$/i,r=/^data:image\/[a-z]+;base64,/;Array.prototype.slice.call(document.querySelectorAll("img[data-original]")).forEach(function(a){var e=a.parentNode;"A"===e.tagName&&(e.href.match(t)||e.href.match(r))&&(e.href=a.dataset.original)})});</script><script>!function(r){r.imageLazyLoadSetting.processImages=t;var e=r.imageLazyLoadSetting.isSPA,n=r.imageLazyLoadSetting.preloadRatio||1,c=a();function a(){var t=Array.prototype.slice.call(document.querySelectorAll("img[data-original]")),e=Array.prototype.slice.call(document.querySelectorAll("[bg-lazy]"));return t.concat(e)}function t(){e&&(c=a());for(var t,o=0;o<c.length;o++)0<=(t=(t=c[o]).getBoundingClientRect()).bottom&&0<=t.left&&t.top<=(r.innerHeight*n||document.documentElement.clientHeight*n)&&function(){var t,e,n,a,i=c[o];e=function(){c=c.filter(function(t){return i!==t}),r.imageLazyLoadSetting.onImageLoaded&&r.imageLazyLoadSetting.onImageLoaded(i)},(t=i).hasAttribute("bg-lazy")?(t.removeAttribute("bg-lazy"),e&&e()):(n=new Image,a=t.getAttribute("data-original"),n.onload=function(){t.src=a,t.removeAttribute("data-original"),e&&e()},t.src!==a&&(n.src=a))}()}function i(){clearTimeout(t.tId),t.tId=setTimeout(t,500)}t(),document.addEventListener("scroll",i),r.addEventListener("resize",i),r.addEventListener("orientationchange",i)}(this);</script></body></html>